<!doctype html>
<head>
<meta charset ="utf-8">
<title>注冊</title>
<style>
div{
    background:#009FCC;
    font-size:24px;
    padding:5px;
    color:white;
}
form{
    background: #F8F8FF ;
    border:#357FC4 solid 1px;
    color:#575454;  
    width:400px;
    margin:20px auto;
    font-size:15px;
}
table{
    margin:10px auto;
}
a{
    text-decoration:none;
}
input[type="button"]{
    background:#228B22;
    color:white;
    font-size:15px;
    font-weight:bold;
    width:120px;
    height:40px;
}
td:first-child{
    text-align:right;
    padding:0 5px;
}
td:only-child{
    text-align:center;
    font-size:12px;
}
span:before{
    content:"* ";
    color:red;
}
input[type="text"]:read-only{
    border:#888484 solid 2px;
    background:#888484;
    font-weight:bold;   
}
input[type="text"]:hover{
    background:#EFD9AC;
}
</style>
<script language="javascript">






function Display(theForm)
{

if(document.frm.name.value==""){
window.alert("亲，填写用户名呀");
document.frm.name.focus();
return (false);
}

if(document.frm.Email.value==""){
window.alert("亲，填写邮箱哪！");
document.frm.Email.focus();
return (false);
}

  if (document.frm.Email.value.indexOf('@', 0) == -1 ||
      document.frm.Email.value.indexOf('.', 0) == -1)
  { alert("邮箱格式不正确，请重试!");
document.frm.Email.value="";
 document.frm.Email.focus(); return (false); }

if(document.frm.Password.value!==document.frm.Password2.value){
window.alert("密码与确认密码不一致");
document.frm.Password.focus();
return (false);
}
 
	LG= localStorage.getItem("Name");
	PW= localStorage.getItem("Password");



	if(  (LG == document.getElementById("Name").value) && (PW == document.getElementById("Password").value)  ){
		alert("帳号已存在!");
	} else {
		localStorage.setItem("Name",document.getElementById("Name").value);
		localStorage.setItem("Password",document.getElementById("Password").value);
		localStorage.setItem("Email",document.getElementById("Email").value);
		alert("注册成功!");
	}

	}

</script>
</head>

<body>
<form method="post" name="frm" onSubmit="Display(this)">
<div>注册账号</div>
<table>
    <tr><td><span>用户名</span></td><td><input type="text" name="Name" id="Name" /></td></tr>
    <tr><td><span>email</span></td><td><input type="text" name="Email" id="Email" /></td></tr>
    <tr><td><span>密码</span></td><td><input type="Password" name="Password"	id="Password" /></td></tr>
    <tr><td><span>确认密码</span></td><td><input type="Password2" id="Password2" /></td></tr>   
    <tr><td>性别</td><td><input type="radio" id="male" name="user_sex" checked />男<input type="radio" id="female" name="user_sex" />女</td></tr>
    <tr><td>手机号码</td><td><input type="text" name="user_phone1" /></td></tr>
    <tr><td colspan="2"><input type="checkbox" checked/>我已看过并接受<a href="#">《用户协议》</a></td></tr>
    <tr><td><input type="submit" value="Submit" onSubmit="return Display(this)"></tr></td>
</table>
</form>
</body>
</html>
